import request from '@/utils/request'

/**
 * 获取规则列表
 * @param { page, pageSize} params
 * @returns
 */
export function getRuleListAPI(params) {
  return request({
    url: 'parking/rule/list',
    params
  })
}

/**
 * 删除规则
 * @param {*} id
 * @returns
 */
export function deleteRuleAPI(id) {
  return request({
    url: `/parking/rule/${id}`,
    method: 'DELETE'
  })
}

/**
 * 获取规则详情
 * @param {*} id 规则ID
 * @returns
 */
export function getRuleDetailAPI(id) {
  return request({
    url: `/parking/rule/${id}`,
    method: 'GET'
  })
}

// 创建规则
export const createRuleAPI = data => request({
  url: '/parking/rule',
  method: 'POST',
  data
})

// 更新规则 - 完全重写
export function updateRuleAPI(data) {
  return request({
    url: '/parking/rule', // 确保没有多余的 /list
    method: 'put',
    data
  })
}
